<div class="main-content">
    <div class="left-panel"></div>
    <div class="panel">
        <?php echo $this->element("backend/left_menu"); ?> 
        <div class="content">
            <div class="title">
                <h2 class="t1">Mr code  Management</h2>
            </div>
            <?php echo $this->session->flash(); ?>
            <?php
            echo $this->Form->create("MrCode");
            echo $this->Form->hidden('id');
            ?>

            <fieldset style="overflow: hidden;border: 1px solid #cccccc;border-radius: 5px;padding: 10px;">
                 <legend id="title" style="font-size:15px;padding:4px;"><?php echo (isset($edit) && $edit ==1)?__("Edit data"):__("Add data");?></legend>
                <div class="input-content">
                    <div class="input ">
                        <label for="last-name">Name code</label>
                             <?php echo $this->Form->input('name_code', array('class' => 'placeholder', 'placeholder' => ' ', 'label' => false, 'div' => false)); ?>
                        <div class="error-message" id="errorTitle"></div>

                    </div>




                    <div class="submit">
                        <?php echo $this->Form->submit("", array('class' => 'save', 'id' => 'btnSave')); ?>
                     <!-- <input type="submit" id="btnSave" value="" class="save"> -->
                        <a href="javascript:resetForm()" id="resetForm" class="reset">Reset</a>
                    </div>
            </fieldset>
                <?php echo $this->Form->end(); ?>
            <br>
            <form action="" id="table-list-admin-form">
                <!--
                  Form add
                -->
                <table cellspacing="0" cellpadding="0" class="display" id="table-list-admin">
                    <thead>
                        <tr class="header">
                            <th class="order" width="5%">
                                <a href="#">#</a>
                            </th>
                            <th>
                                <a href="">Name Code</a>
                            </th>

                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $i = 1;
                        foreach ($mrCodes as $k => $v) {
                            ?>
                            <tr>
                                <td><?php echo $i++; ?></td>
                                <td>
    <?php echo h($v['MrCode']['name_code']); ?> 
                                </td>

                                <td class="action" nowrap >
                                    <a class="edit" title="Edit" href="<?php echo $this->Html->url("/MrCodes/admin_index/" . $v['MrCode']['id']); ?>" >Edit</a>
                                    <a class="delete" href="<?php echo $this->Html->url("/MrCodes/admin_delete/" . $v['MrCode']['id']); ?>" title="Delete" onclick="return confirm('Are you sure you want to delete <?php echo $v["MrCode"]['name_code'] ?> ');">Delete</a>
                                </td>
                            </tr>
<?php } ?>

                    </tbody>
                </table>
            </form>
            <br />
            <div>
<?php echo $this->Paginator->prev('', array('tag' => 'a', 'class' => 'page-far-left', 'id' => 'prev'), '', array('tag' => 'a', 'class' => 'page-far-left', 'id' => 'prev')); ?>
                <div id="page-info">Page 
                    <strong><?php echo $this->request->params['paging']['MrCode']['page'] ?>
                    </strong>/ <?php echo $this->request->params['paging']['MrCode']['pageCount'] ?>
                </div>
<?php echo $this->Paginator->next("", array('tag' => 'a', 'class' => 'page-far-right', 'id' => 'next'), null, array('tag' => 'a', 'class' => 'page-far-right', 'id' => 'next')); ?>

            </div>

        </div>
    </div>
    <div class="right-panel"></div>
    <!-- main.end -->
</div>
<script>
    $(".page-far-left").click(function() {

        window.location.href = document.getElementById('prev').href;
    });
    $(".page-far-right").click(function() {

        window.location.href = document.getElementById('next').href;
    });
     $("#btnSave").click(function() {
        var validateTile = new validate("MrCodeNameCode", "errorTitle", "This field is not empty.");
        var result = validateTile.notEmpty();
        if (!(result))
        {
            $('html, body').animate({scrollTop: 0}, 'slow');
        }
        return result;
    });
    function resetForm()
    {
        window.location.reload();
    }
</script>